package com.mzj.saas.jobs.oss;

import com.aliyun.oss.OSSClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OssConfig {
	/**
	 * OSS配置
	 */
	@Value("${ali.oss.endpoint}")
	private String endpoint;
	@Value("${ali.oss.accessKeyId}")
	private String accessKeyId;
	@Value("${ali.oss.accessKeySecret}")
	private String accessKeySecret;
	/**
	 * 对象存储桶名称
	 */
	@Value("${ali.oss.bucket}")
	private String ossBucketName;
	/**
	 * 对象存储有效期
	 */
	@Value("${ali.oss.expired}")
	private Integer ossExpired;
	/**
	 * 桶路径
	 */
	@Value("${ali.oss.bucket.url}")
	private String bucketUrl;
	
	/**
	 * 图片下载临时目录
	 */
	@Value("${ali.oss.downFile.tempdir}")
	private String downFileTempdir;

	/**
	 * 客户端
	 * 
	 * @return
	 * @author shun
	 * @date 2021年3月23日
	 */
	@Bean
	public OSSClient obsClient() {
		return new OSSClient(endpoint, accessKeyId, accessKeySecret);
	}

	public String getEndpoint() {
		return endpoint;
	}

	public String getAccessKeyId() {
		return accessKeyId;
	}

	public String getAccessKeySecret() {
		return accessKeySecret;
	}

	public String getOssBucketName() {
		return ossBucketName;
	}

	public Integer getOssExpired() {
		return ossExpired;
	}

	public void setOssExpired(Integer ossExpired) {
		this.ossExpired = ossExpired;
	}

	public String getBucketUrl() {
		return bucketUrl;
	}

	public String getDownFileTempdir() {
		return downFileTempdir;
	}

}